package com.example.designer.iter.impl;

import com.example.designer.iter.pojo.Foot;

import java.util.Iterator;
import java.util.List;

public class ListIterator implements Iterator {

    List<Foot> footList;
    int pos = 0;

    public ListIterator(List<Foot> footList) {
        this.footList = footList;
    }

    @Override
    public boolean hasNext() {
        if (pos >= footList.size() || footList.get(pos) == null){
            return false;
        }else {
            return true;
        }
    }

    @Override
    public Object next() {
        Foot foot = footList.get(pos);
        pos++;
        return foot;
    }
}
